package yamen.bdwm.datastruct;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class WmDataAdapter extends BaseAdapter{

	protected LayoutInflater mLayoutInflater;  
	 Context context;
    protected int mResource;    
    List<WmItem> list;
    public WmDataAdapter(int resouce,WmList l) {  
        this.mResource = resouce;  
        this.list = l.list;
    }  
    public void setContext(Context context)
    {
    	this.mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    	this.context=context;
    }
	public int getCount() {
		return list.size();
	}

	public Object getItem(int position) {
		return list.get(position);
	}

	public long getItemId(int position) {
//		return Long.parseLong(list.get(position).id);
		return position;
	}
	public void setSelectItem(int selectItem) {
		this.selectItem = selectItem;
		}
	public void SelectAndMark(int a)
	{
		setSelectItem(a);
		this.notifyDataSetChanged();
	}
	protected int selectItem=-1;
	public View getView(int position, View convertView, ViewGroup parent)
	{
		return ((WmItem)getItem(position)).getView(null,mLayoutInflater,mResource,convertView,parent);
	}
}
